jsx3.lang.Package.definePackage("tibco.admin.enterpriseAssets.envDef.envDtls.medBus", function (envDtls) {
});

/**
 * Env Def - Env Details mail area
 */
jsx3.lang.Class.defineClass("tibco.admin.enterpriseAssets.envDef.envDtls.medBus.MedBus",
        jsx3.lang.Object,
        [tibco.admin.enterpriseAssets.envDef.envDtls.EnvDtlsNavInterface],
        function (plugin) {

            // implementation specific fields
            plugin.instance = null;
            plugin.prototype.EnvId = null;

            // interface method
            plugin.prototype.getNamespace = function() {
                return "tibco.admin";
            }

            // interface method, if there is no custom code required
            // this can be skipped
            plugin.prototype.initPlugin = function() {

            }


            //interface method
            plugin.prototype.destroyPlugin = function() {
                //cleanup
            }

            //interface method, return either static instance or new instance is upto
            // implementation requirement
            plugin.getInstance = function() {
                if(!this.instance) {
                    this.instance = new tibco.admin.enterpriseAssets.envDef.envDtls.medBus.MedBus();
                }
                return this.instance;
            }

            // this method need to satisfy the tibco.admin.plugin.PluginInterface
            // Using this optional.
            plugin.prototype.loadComponent = function(parent) {
                var me = this;
                tibco.admin.Main.loadUIResourceAsync(parent, "tibco.admin", "tibco/admin/enterpriseAssets/envDef/envDtls/medBus/ui/Bus.xml", me, me.componentLoaded);
            }

            plugin.prototype.getNavLinkText = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@@NavLinkTextMedBus");
            }

            plugin.prototype.componentLoaded = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.block = objEvent.obj;
                    var me = this;
                    this.block.handler = me;
                    var QOSPane = this.block.getDescendantOfName("paneQOS_27CDE", true);
                    var SvrListPane = this.block.getDescendantOfName("paneMsgSvr_27CDE", true);
                    var SvrDtlsPane = this.block.getDescendantOfName("paneSvrDtls_27CDE", true);
                    tibco.admin.Main.loadUIResourceAsync(QOSPane, "tibco.admin", "tibco/admin/enterpriseAssets/envDef/envDtls/medBus/quality/ui/quality.xml", me, me.qualityLoaded);
                    tibco.admin.Main.loadUIResourceAsync(SvrListPane, "tibco.admin", "tibco/admin/enterpriseAssets/envDef/envDtls/medBus/mesSer/ui/messageServer.xml", me, me.masterLoaded);
                    tibco.admin.Main.loadUIResourceAsync(SvrDtlsPane, "tibco.admin", "tibco/admin/enterpriseAssets/envDef/envDtls/medBus/serDtls/ui/serDtls.xml", me, me.detailsLoaded);
                }
                else {
                    if(objEvent.exception)
                    {
                        tibco.admin.Main.logException(objEvent.exception, objEvent.message);
                    }
                    else {
                        jsx3.log(objEvent.message);
                    }
                }
            }

            plugin.prototype.qualityLoaded = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.qualityBlock = objEvent.obj;
                    var me = this;
                    this.qualityBlock.handler = me;
                }
                else {
                    if(objEvent.exception)
                    {
                        tibco.admin.Main.logException(objEvent.exception, objEvent.message);
                    }
                    else {
                        jsx3.log(objEvent.message);
                    }
                }
            }

            plugin.prototype.masterLoaded = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.masterBlock = objEvent.obj;
                    var me = this;
                    this.masterBlock.handler = me;
                }
                else {
                    if(objEvent.exception)
                    {
                        tibco.admin.Main.logException(objEvent.exception, objEvent.message);
                    }
                    else {
                        jsx3.log(objEvent.message);
                    }
                }
            }

            plugin.prototype.detailsLoaded = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.detailsBlock = objEvent.obj;
                    var me = this;
                    this.detailsBlock.handler = me;
                }
                else {
                    if(objEvent.exception)
                    {
                        tibco.admin.Main.logException(objEvent.exception, objEvent.message);
                    }
                    else {
                        jsx3.log(objEvent.message);
                    }
                }
            }

            plugin.prototype.isQOSInEditMode = function() {
                return this.QOSEditMode;
            }

            /**
             plugin.prototype.getPathToDetailsBlock = function(){
             return tibco.admin.Main.resolveURI("tibco.admin", "tibco/admin/enterpriseAssets/envDef/envDtls/MedBus/ui/Bus.xml");

             }
             **/
            plugin.prototype.beginQOSEditMode = function() {
                this.QOSEditMode = true;
                if(!this.isInEditMode()) {
                    this.beginEditMode();
                }
            }

            plugin.prototype.endQOSEditMode = function(context) {
                this.QOSEditMode = false;
                if(!this.DetailsEditMode) {
                    this.endEditMode();
                }
            }

            plugin.prototype.isDetailsInEditMode = function() {
                return this.DetailsEditMode;
            }

            plugin.prototype.beginDetailsEditMode = function() {
                this.DetailsEditMode = true;
                if(!this.isInEditMode()) {
                    this.beginEditMode();
                }
                this.masterBlock.beginDetailsEdit()
            }

            plugin.prototype.endDetailsEditMode = function(context) {
                this.DetailsEditMode = false;
                if(!this.QOSEditMode) {
                    this.endEditMode();
                }
                this.masterBlock.endDetailsEdit()
            }

            plugin.prototype.getComponentPath = function() {
                return  "tibco/admin/enterpriseAssets/envDef/envDtls/medBus/component.xml"
            }

            plugin.prototype.buttonSelected = function() {
                if(this.qualityBlock) {
                    this.qualityBlock.callgetQualityOfService(null, true);
                }
                if(this.masterBlock) {
                    this.masterBlock.onRefresh();
                }
            }
        });